package com.manfred.H2Study;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

/**
 * Hello world!
 *
 */
public class App {
	public static void main(String[] args) throws Exception {
		Class.forName("org.h2.Driver");
		Connection conn = DriverManager.getConnection("jdbc:h2:~/test", "sa",
				"");
		// add application code here
		Statement s = conn.createStatement();
		// s.execute("CREATE TABLE USER (ID INT, NAME VARCHAR(50))");
		s.execute("insert into user values('12', '2222')");
		conn.commit();
		ResultSet set = s.executeQuery("select * from user");
		while (set.next()) {
			System.out.println(set.getInt("id"));
		}

		conn.close();
	}
}
